#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000+10;

int main() {
    //ios_base::sync_with_stdio(false);cin.tie(nullptr);
    int T; cin >> T;
    while(T--){
        int N; cin >> N;
        vector<int> Y[maxn];
        for (int i = 0; i < N; ++i) {
            int x, y; cin >> x >> y;
            Y[y].emplace_back(x);
        }
        double mid;
        bool first = true;
        for (const auto& i:Y){
            if(i.empty()) continue;
            double t = 0;
            for (auto j:i){
                t += j;
            }
            t /= i.size();
            if(first) {first = false; mid = t;}
            else{
                if(abs(mid - t) < 1e-5) continue;
                else {cout << "NO\n"; goto END;}
            }
        }
        cout << "YES\n";
        END:;
    }
    return 0;
}